package com.xiantm.study.thread.future.jdk;

import com.xiantm.study.thread.future.Data;

import java.util.concurrent.ExecutionException;


public class Main {
    public static void main(String[] args) throws ExecutionException {
        System.out.println("Main begin.");

        Host host = new Host();
        Data data1 = host.request(10, 'A');
        Data data2= host.request(20, 'B');
        Data data3 = host.request(30, 'C');
        System.out.println("main otherJob begin.");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("main otherJob end.");
        System.out.println("d1 = " + data1.getContent());
        System.out.println("d2 = " + data2.getContent());
        System.out.println("d3 = " + data3.getContent());
        System.out.println("Main end.");
    }
}
